import { http } from '@/utils/http'
import type { LoginResult } from '@/types/member'

type LoginParams = {
  code: string // 微信登录code
  encryptedData: string // 微信加密数据
  iv: string // 微信加密数据解密算法的初始向量
}

// 微信小程序登录
export const postLoginWxMin = (data: LoginParams) => {
  return http<LoginResult>({
    method: 'POST',
    url: '/login/wxMin',
    data,
  })
}
/**
 * 微信小程序登录
 * @param phoneNumber 模拟手机号码
 */
export const postLoginWxMinTest = (phoneNumber: string) => {
  return http<LoginResult>({
    method: 'POST',
    url: '/login/wxMin/simple',
    data: {
      phoneNumber,
    },
  })
}
